$(document).ready(function() {
//   $('aside > nav.admin-action-list > ul > li > a')
   var pathname = window.location.pathname;
   var paths = pathname.split('/');
   var activeindex = -1;
   if(paths.length > 4) {
      if(paths[4].toLowerCase() == 'list') activeindex = 1;
      else if(paths[4].toLowerCase() == 'post') activeindex = 0;
   }

   $('aside > nav.admin-action-list > ul').accordion({ header: "h5", active :activeindex,collapsible: true, heightStyle: "auto" });
   
   $('button[type="submit"]').button();
});


$().ready(function() { 
   $('table.template-grid tr:first-child').each(function() {
      $(this).addClass('ui-widget-header');
   });
   $("table.template-grid th").each(function(){
      $(this).addClass("ui-state-default"); 
   });
   
   $("table.template-grid td").each(function(){
      $(this).addClass("ui-widget-content");
   });
   
   $("table.template-grid tr").hover(
     function() {
      $(this).children("td").addClass("ui-state-hover");
     }, function() {
         $(this).children("td").removeClass("ui-state-hover");
     });
});